package com.structure.compositePattern.model.vo;

/**
 * 限定类型
 * @author xiaobing
 * @version 1.0
 * @date 2021/9/9 4:55 下午
 */
public enum RuleLimitTypeEnum {

    MORE_THAN_THE(2,"大于"),
    LESS_THAN(3,"小于"),
    GREATER_OR_EQUAL_TO(4,"大于等于"),
    LESS_THAN_OR_EQUAL_TO(5,"小于等于"),
    ;
    /**
     * 类型
     */
    private final Integer type;
    /**
     * 描述
     */
    private final String desc;

    public Integer getType() {
        return type;
    }

    public String getDesc() {
        return desc;
    }

    RuleLimitTypeEnum(Integer type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public static RuleLimitTypeEnum getRuleLimitTypeEnumByType(Integer type){
        if (type == null){
            return null;
        }
        for (RuleLimitTypeEnum value : RuleLimitTypeEnum.values()) {
            if (value.type.equals(type)){
                return value;
            }
        }
        return null;
    }
}
